/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package DTO;

public class CSanPham extends CTao{
    public CSanPham(){
        this.tonToiDaCH = 20;
        this.tonToiThieuCH = 5;
        this.donGia = 0.0;
        this.giaNhap = 0.0;
        this.thuevat = 0;
        this.tonToiThieu = 0;
        soLgTonToiDa = 0;
        this.maSanPham ="";
        this.tenSanPham ="";
    }
    
    private Double giaNhap;
    public void setGiaNhap(Double gianhap){
        this.giaNhap = gianhap;
    }
    public Double getGiaNhap(){
        return this.giaNhap;
    }
    private int thuevat;
    public void setThueVat(int tv){
        this.thuevat = tv;
    }
    
    public int getThueVat(){
        return this.thuevat;
    }
    private Double donGia;
    public void setDonGia(double donGia){
        this.donGia = donGia;
    }
    public double getDonGia(){
        return this.donGia;
    }
    
    private String donVi;
    public void setDonVi(String dv){
        this.donVi = dv;
    }
    public String getDonVi(){
        return this.donVi;
    }
    
    
    private String maSanPham;
    public void setMaSanPham(String maSanPham){
        this.maSanPham = maSanPham;
    }
    public String getMaSanPham(){
        return this.maSanPham;
    }
    
    private String tenSanPham;
    public void setTenSanPham(String tensanpham){
        this.tenSanPham = tensanpham;
    }    
    public String getTenSanPham(){
        return this.tenSanPham;
    }
    
    private int tonToiThieu;
    public void setTonToiThieu(int soluongton){
        this.tonToiThieu = soluongton;                
    }
    public int getTonToiThieu(){
        return this.tonToiThieu;
    }
    
    private int soLgTonToiDa;
    public void setSoLgTonToiDa(int slt_toi_da){
        this.soLgTonToiDa = slt_toi_da;
    }
    public int getSoLgTonToiDa(){
        return this.soLgTonToiDa;
    }    
    private int tonToiThieuCH;
    public void setTonToiThieuCH(int ton_toi_thieu){
        this.tonToiThieuCH = ton_toi_thieu;
    }
    public int getTonToiThieuCH(){
        return this.tonToiThieuCH;
    }    
    private int tonToiDaCH;
    public void setTonToiDaCH(int ton_toi_da){
        this.tonToiDaCH = ton_toi_da;
    }    
    public int getTonToiDaCH(){
        return this.tonToiDaCH;
    }
    public String json(){
        StringBuilder sBuilder = new StringBuilder();
         sBuilder.append("{");
        sBuilder.append(String.format("\"%s\" :\" %s \"",CFields.id,this.getId() ));
        sBuilder.append(",");
        sBuilder.append(String.format("\"%s\" :\" %s \"",CFields.don_gia,this.getDonGia()));        
        sBuilder.append(",");
        sBuilder.append(String.format("\"%s\" :\" %s \"",CFields.gia_nhap,this.getGiaNhap()));       
        sBuilder.append(",");
        sBuilder.append(String.format("\"%s\" :\" %s \"",CFields.ma_sp,this.getMaSanPham()));        
        sBuilder.append(",");
        sBuilder.append(String.format("\"%s\" :\" %s \"",CFields.ten_san_pham,this.getTenSanPham()));        
        sBuilder.append(",");
        sBuilder.append(String.format("\"%s\" :\" %s \"",CFields.ton_toi_da,this.getSoLgTonToiDa()));   
        sBuilder.append(",");
        sBuilder.append(String.format("\"%s\" :\" %s \"",CFields.ton_toi_da_ch,this.getTonToiDaCH()));        
        sBuilder.append(",");
        sBuilder.append(String.format("\"%s\" :\" %s \"",CFields.ton_toi_thieu,this.getTonToiThieu()));   
        
        sBuilder.append("}");
        return sBuilder.toString();
    }
     public String toString(){
        StringBuilder sBuilder = new StringBuilder();
        sBuilder.append("{");
        sBuilder.append(String.format("\"%s\" :\" %s \"",CFields.id,this.getId() ));
        sBuilder.append(",");
        sBuilder.append(String.format("\"%s\" :\" %s \"",CFields.don_gia,this.getDonGia()));        
        sBuilder.append(",");
        sBuilder.append(String.format("\"%s\" :\" %s \"",CFields.gia_nhap,this.getGiaNhap()));        
        sBuilder.append(",");
        sBuilder.append(String.format("\"%s\" :\" %s \"",CFields.ma_sp,this.getMaSanPham()));        
        sBuilder.append(",");
        sBuilder.append(String.format("\"%s\" :\" %s \"",CFields.ten_san_pham,this.getTenSanPham()));        
        sBuilder.append(",");
        sBuilder.append(String.format("\"%s\" :\" %s \"",CFields.ton_toi_da,this.getSoLgTonToiDa()));        
        sBuilder.append(",");
        sBuilder.append(String.format("\"%s\" :\" %s \"",CFields.ton_toi_da_ch,this.getTonToiDaCH()));        
        sBuilder.append(",");
        sBuilder.append(String.format("\"%s\" :\" %s \"",CFields.ton_toi_thieu,this.getTonToiThieu()));                
        sBuilder.append("}");
        return sBuilder.toString();
    }
}
